'\" te
.\"  Copyright (c) 1998, Sun Microsystems, Inc.  All Rights Reserved
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH ADDBADSEC 8 "Feb 24, 1998"
.SH NAME
addbadsec \- map out defective disk blocks
.SH SYNOPSIS
.LP
.nf
\fBaddbadsec\fR [\fB-p\fR] [\fB-a\fR \fIblkno\fR [\fIblkno\fR]...] [\fB-f\fR \fIfilename\fR] \fIraw_device\fR
.fi

.SH DESCRIPTION
.sp
.LP
\fBaddbadsec\fR is used by the system administrator to map out bad disk blocks.
Normally, these blocks are identified during surface analysis, but occasionally
the disk subsystem reports unrecoverable data errors indicating a bad block. A
block number reported in this way can be fed directly into \fBaddbadsec\fR, and
the block will be remapped. \fBaddbadsec\fR will first attempt hardware
remapping. This is supported on \fBSCSI\fR drives and takes place at the disk
hardware level. If the target is an \fBIDE\fR drive, then software remapping is
used. In order for software remapping to succeed, the partition must contain an
alternate slice and there must be room in this slice to perform the mapping.
.sp
.LP
It should be understood that bad blocks lead to data loss. Remapping a
defective block does not repair a damaged file. If a bad block occurs to a
disk-resident file system structure such as a superblock, the entire slice
might have to be recovered from a backup.
.SH OPTIONS
.sp
.LP
The following options are supported:
.sp
.ne 2
.na
\fB\fB-a\fR\fR
.ad
.RS 6n
Adds the specified blocks to the hardware or software map. If more than one
block number is specified, the entire list should be quoted and block numbers
should be separated by white space.
.RE

.sp
.ne 2
.na
\fB\fB-f\fR\fR
.ad
.RS 6n
Adds the specified blocks to the hardware or software map. The bad blocks are
listed, one per line, in the specified file.
.RE

.sp
.ne 2
.na
\fB\fB-p\fR\fR
.ad
.RS 6n
Causes \fBaddbadsec\fR to print the current software map. The output shows the
defective block and the assigned alternate. This option cannot be used to print
the hardware map.
.RE

.SH OPERANDS
.sp
.LP
The following operand is supported:
.sp
.ne 2
.na
\fB\fIraw_device\fR\fR
.ad
.RS 14n
The address of the disk drive (see \fBFILES\fR).
.RE

.SH FILES
.sp
.LP
The raw device should be \fB/dev/rdsk/c?[t?]d?p0\fR. See \fBdisks\fR(8) for an
explanation of \fBSCSI\fR and \fBIDE\fR device naming conventions.
.SH SEE ALSO
.sp
.LP
.BR attributes (7),
.BR disks (8),
.BR diskscan (8),
.BR fdisk (8),
.BR fmthard (8),
.BR format (8)
.SH NOTES
.sp
.LP
The \fBformat\fR(8) utility is available to format, label, analyze, and repair
\fBSCSI\fR disks. This utility is included with the \fBaddbadsec\fR,
\fBdiskscan\fR(8), \fBfdisk\fR(8), and \fBfmthard\fR(8) commands available
for x86. To format an \fBIDE\fR disk, use the \fB DOS\fR "format" utility;
however, to label, analyze, or repair \fBIDE\fR disks on x86 systems, use the
Solaris \fBformat\fR(8) utility.
